package info.douyi.dps.controller;

import com.github.pagehelper.PageInfo;
import info.douyi.dps.model.Pest;
import info.douyi.dps.service.SelectService;
import info.douyi.dps.utils.PageResult;
import info.douyi.dps.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/selectPest")
public class SelectController {

    @Autowired
    private SelectService selectService;

    @GetMapping("/selectPestByKeyword/")
    public Object selectPestByKeyword(@RequestParam() String keyword, @RequestParam(defaultValue = "1") int pageNum, @RequestParam(defaultValue = "5") int pageSize) {
        return Result.success(PageResult.of(selectService.selectPestByKeywordAndPage(keyword,pageNum,pageSize)));
    }
}
